window.onload = function () {
    var left_div = document.getElementById("left");
    var right_div = document.getElementById("right");
    var huakui = document.getElementById("huakuai");
    var big_pic = document.getElementById("big");
    left_div.onmousemove = function () {
        huakui.style.display = "block";
        right_div.style.display = "block";
    }
    left_div.onmouseout = function () {
        huakui.style.display = "none";
        right_div.style.display = "none";
    }

    document.getElementById('gaizi').onmousemove = function (e) {
        var ev = e || window.event;
        var m_left = ev.offsetX || ev.layerX; //或得鼠标在事件上的位置 
        var m_top = ev.offsetY || ev.layerY;//或得鼠标在事件上的位置 
        hk_left = m_left - 100;
        if (hk_left < 0) { hk_left = 0 };
        if (hk_left > 200) { hk_left = 200 };

        hk_top = m_top - 100;
        if (hk_top < 0) { hk_top = 0 };
        if (hk_top > 200) { hk_top = 200 };

        huakui.style.left = hk_left + "px"; //给小滑块赋值 
        huakui.style.top = hk_top + "px";//给小滑块赋值 

        var right_left = hk_left * -2;
        var right_top = hk_top * -2; // 修改此处为hk_top
        big_pic.style.left = right_left + "px";
        big_pic.style.top = right_top + "px";

    }

    document.getElementById('btnAddcart').addEventListener('click', function (event) {
        event.preventDefault();
        alert('成功加入购物车');
    });

    document.getElementById('btnsoonbuy').addEventListener('click', function (event) {
        event.preventDefault();
        alert('立即购买成功');
    });
}